﻿using Blog.Dto.Author;
using Blog.Model;
using AutoMapper;
using Blog.Model.Dto.Article;

namespace Blog.Profiles
{
	public class AuthorMap:Profile
	{
        public AuthorMap()
        {
			CreateMap<Author, AuthorDto>();
			CreateMap<Article, ArticleDto>()
				.ForMember(target=> target.ArticleTypeName,source => source.MapFrom(src => src.ArticleType.TypeName))
				.ForMember(target => target.AuthorName, source => source.MapFrom(src =>src.Author.Name));
		}
    }
}
